#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   word_check.py    
@Contact :   fengfeng.qiu@amh-group.com

@Modify Time      @Author    
------------      -------    
2022/5/6 10:19   qiufengfeng      
'''

words = []
types = []
with open('all_contraband_word.txt',encoding='utf-8') as fread:
    for line in fread:
        word,type = line.strip().split(" ")
        if word not in words:
            words.append(word)
            types.append(type)

mysql_words = []
with open("mysql_word.csv",encoding='utf-8') as fread:
    for line in fread:
        if line.strip():
            mysql_words.append(line.strip())

with open('all_contraband_word_new.txt',mode='w',encoding='utf-8') as fwrite:
    fwrite.write("\n".join([word + " "+ type for word,type in zip(words,types) if word not in mysql_words]))
